<template>
  <div>&nbsp;</div>
</template>

<script>
import iframeMixin from '@/utils/iframes/iframes-mixin'
import { nextPageId } from '@/utils/iframes/iframes-config'
import menuApi from '../../api/iam/webMenu'

export default {
  name: 'MenuIFrame',
  mixins: [iframeMixin],
  data() {
    return {
      PAGE_ID: nextPageId(),
      PARAMS: ''
    }
  },
  methods: {
    loadParams(resolve, reject) {
      const id = this.$route.params && this.$route.params.id
      return new Promise((resolve, reject) => {
        menuApi.fetch(id).then(response => {
          const { data } = response
          const { info } = data
          const route = Object.assign({}, this.$route, { title: info.name })
          this.$store.dispatch('tagsView/updateVisitedView', route)
          this.PARAMS = '/menu/' + id
          resolve()
        }).catch(error => {
          reject(error)
        })
      })
    }
  }
}
</script>
